| Conditions | 1 |
| Total Lines | 56 |
| Code Lines | 50 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React, { Component } from "react" |
||
| 21 | renderPlayerStats = () => ( |
||
| 22 | <aside className={"player--featured__statistics"}> |
||
| 23 | <section className={"player--featured__statistics-item"}> |
||
| 24 | <div className={"player--featured__statistics-item__number"}> |
||
| 25 | {this.props.player.gamesPlayed || "0"} |
||
| 26 | </div> |
||
| 27 | <div className={"player--featured__statistics-item__label"}> |
||
| 28 | Wedstrijden |
||
| 29 | </div> |
||
| 30 | </section> |
||
| 31 | |||
| 32 | {this.props.player.position === "k" && ( |
||
| 33 | <section className={"player--featured__statistics-item"}> |
||
| 34 | <div className={"player--featured__statistics-item__number"}> |
||
| 35 | {this.props.player.cleanSheets || "0"} |
||
| 36 | </div> |
||
| 37 | <div className={"player--featured__statistics-item__label"}> |
||
| 38 | Cleansheets |
||
| 39 | </div> |
||
| 40 | </section> |
||
| 41 | )} |
||
| 42 | {this.props.player.position !== "k" && ( |
||
| 43 | <section className={"player--featured__statistics-item"}> |
||
| 44 | <div className={"player--featured__statistics-item__number"}> |
||
| 45 | {this.props.player.goalsScored || "0"} |
||
| 46 | </div> |
||
| 47 | <div className={"player--featured__statistics-item__label"}> |
||
| 48 | Doelpunten |
||
| 49 | </div> |
||
| 50 | </section> |
||
| 51 | )} |
||
| 52 | <section |
||
| 53 | className={ |
||
| 54 | "player--featured__statistics-item player--featured__statistics-item--cards" |
||
| 55 | } |
||
| 56 | > |
||
| 57 | <div className={"player--featured__statistics-item__number"}> |
||
| 58 | {this.props.player.cardsYellow || "0"} |
||
| 59 | </div> |
||
| 60 | <div className={"player--featured__statistics-item__label"}> |
||
| 61 | <span className={"stats__card stats__card--yellow"}></span> |
||
| 62 | </div> |
||
| 63 | </section> |
||
| 64 | <section |
||
| 65 | className={ |
||
| 66 | "player--featured__statistics-item player--featured__statistics-item--cards" |
||
| 67 | } |
||
| 68 | > |
||
| 69 | <div className={"player--featured__statistics-item__number"}> |
||
| 70 | {this.props.player.cardsRed || "0"} |
||
| 71 | </div> |
||
| 72 | <div className={"player--featured__statistics-item__label"}> |
||
| 73 | <span className={"stats__card stats__card--red"}></span> |
||
| 74 | </div> |
||
| 75 | </section> |
||
| 76 | </aside> |
||
| 77 | ) |
||
| 119 |